package org.bdware.doip.core.codec.packet;

import org.bdware.doip.core.doipMessage.DoipMessage;
import org.bdware.doip.core.doipMessage.MessageEnvelope;
import org.bdware.doip.core.exception.MessageCodecException;

import java.net.InetSocketAddress;
import java.util.ArrayList;

public interface PacketMessageCodec {

    byte[] EnvelopeToBytes(MessageEnvelope envelope) throws MessageCodecException;
    MessageEnvelope BytesToEnvelope(byte[] envelopeBytes) throws MessageCodecException;

    DoipMessage EnvelopesToMessage(ArrayList<MessageEnvelope> envelopList) throws MessageCodecException;
    ArrayList<MessageEnvelope> MessageToEnvelopes(DoipMessage msg) throws MessageCodecException;

    byte[] MessageToBytes(DoipMessage msg) throws MessageCodecException;
    DoipMessage BytesToMessage(byte[] msgBytes,int requestId, InetSocketAddress sender) throws MessageCodecException;
}
